package com.heima.freemarker.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * @author itheima
 * @since 2022-07-04
 */
@Controller
public class HelloController {

    @GetMapping("/hello")
    public String hello(Model model) {
        model.addAttribute("name","itheima");
        HashMap<String, Object> stu = new HashMap<>();
        stu.put("name","张三");
        stu.put("age",18);
        model.addAttribute("stu",stu);
        HashMap<String, Object> stu2 = new HashMap<>();
        stu2.put("name","李四");
        stu2.put("age",20);
        List<Map<String,Object>> list=new ArrayList<>();
        list.add(stu);
        list.add(stu2);
        model.addAttribute("stus",list);
        model.addAttribute("today", new Date());


        return "01-basic";
    }

}
